#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
char c;
string s;
int main()
{
	while (cin >> c >> s) {
		int cnt = 0;
		if (c >= 'A' && c <= 'Z')c += 32;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] >= 'A' && s[i] <= 'Z')s[i] += 32;
		}
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == c)cnt++;
		}
		double ans = (cnt * 1.0) / s.size();
		printf("%.5lf\n", ans);
	}
	return 0;
}